<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="./css/bootstrap.css">
</head>
<body>
<?php
    $id=$_GET['id'];
    //获取连接传递的数据id

    //获取id 从数据库 所有字段信息

    //引入链接 conn.php
    require_once './conn.php';
    $sql="select * from users where id = '".$id."'";
    $result = mysqli_query($link,$sql);
    //构造sql select * from users where id=?
    $row=mysqli_fetch_array($result);
    var_dump($row);
    //把数据放在表单 value 


    //UI界面
?>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-sm-6"> 
    <h1>插入数据</h1>
    <form method="POST" action="">
        <div class="form-group">
            <label for="username">姓名</label>
            <input type="text" class="form-control" id="username" name="username" value="<?php echo $row['name'];?>">
          </div>
          <div class="form-group">
            <label for="email">邮箱</label>
            <input type="text" class="form-control" id="email" name="email"value="<?php echo $row['email'];?>">
          </div>
          <div class="form-group">
            <label for="mobile">电话号码</label>
            <input type="text" class="form-control" id="mobile" name="mobile"value="<?php echo $row['mobile'] ;?>">
          </div>
        <button type="submit" class="btn btn-primary" name="save">提交</button>
        <a href="./index.php" class="btn btn-success">返回</a>
      </form>
    </div>
</div>
</div>
</body>
</html>
